<div class="content-wrapper">
    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>
        <h1 class="pull-right">
            <?php echo $this->HelpUrl('userWithdrawList'); ?>
        </h1>
    </section>

    <section class="content">
        <?php echo $this->partial('layout/messages'); ?>

        <div class="row">
            <div class="col-xs-12">
                <div class="box shop-box">

                    <div class="box-body table-responsive no-padding">
                        <table class="table shop-table table-hover">
                            <thead>
                            <tr class="shop-bg-thead">
                                <th width="15%"><?php echo $this->translate('申请时间'); ?></th>
                                <th width="10%"><?php echo $this->translate('状态'); ?></th>
                                <th width="12%"><?php echo $this->translate('申请人'); ?></th>
                                <th width="10%"><?php echo $this->translate('审核人'); ?></th>
                                <th width="10%"><?php echo $this->translate('提现金额/货币'); ?></th>
                                <th width="13%"><?php echo $this->translate('审核时间'); ?></th>
                                <th width="18%"><?php echo $this->translate('备注'); ?></th>
                                <th width="10%"><?php echo $this->translate('操作'); ?></th>
                            </tr>
                            <?php
                            $sForm = $this->searchForm;
                            $sForm->prepare();
                            $sForm->get('withdraw_state')->setEmptyOption('选择状态');
                            ?>
                            <?php echo $this->form()->openTag($sForm); ?>
                            <tr>
                                <td>
                                    <p>
                                        <?php echo $this->formElement($sForm->get('add_start_time')); ?>
                                    </p>
                                    <div>
                                        <?php echo $this->formElement($sForm->get('add_end_time')); ?>
                                    </div>
                                    <?php echo $this->formElementErrors($sForm->get('add_start_time'), ['class'=>'error-message']);?>
                                    <?php echo $this->formElementErrors($sForm->get('add_end_time'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('withdraw_state')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('withdraw_state'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('user_name')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('user_name'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('admin_name')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('admin_name'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('withdraw_num')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('withdraw_num'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <p>
                                        <?php echo $this->formElement($sForm->get('finish_start_time')); ?>
                                    </p>
                                    <div>
                                        <?php echo $this->formElement($sForm->get('finish_end_time')); ?>
                                    </div>
                                    <?php echo $this->formElementErrors($sForm->get('finish_start_time'), ['class'=>'error-message']);?>
                                    <?php echo $this->formElementErrors($sForm->get('finish_end_time'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('withdraw_info')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('withdraw_info'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <button type="submit" class="btn btn-info btn-sm"><i class="fa fa-search"></i></button>
                                    <?php
                                    $formData = $sForm->getData();
                                    if(!empty(array_filter($formData))) { ?>
                                        &nbsp;&nbsp;<a href="<?php echo $this->url('user-balance', ['action' => 'withdrawList']);?>" class="btn btn-default btn-sm"><i class="fa fa-reply"></i></a>
                                    <?php } ?>
                                </td>
                            </tr>
                            <?php echo $this->form()->closeTag(); ?>
                            </thead>
                            <tbody>
                            <?php if($this->withdrawList->getCurrentItemCount() > 0) foreach ($this->withdrawList as $withdrawValue) { ?>
                                <tr>
                                    <td><?php echo $this->shopDateFormat()->shopWithdrawTime($withdrawValue->getAddWithdrawTime()); ?></td>
                                    <td><?php echo $this->userHelper()->getWithdrawState($withdrawValue->getWithdrawState()); ?></td>
                                    <td><?php echo $this->escapeHtml($withdrawValue->getUserName()); ?></td>
                                    <td><?php echo $this->escapeHtml($withdrawValue->getAdminName()); ?></td>
                                    <td><?php echo $withdrawValue->getMoneyChangeNum() . '/' . $withdrawValue->getCurrencyCode(); ?></td>
                                    <td><?php echo !empty($withdrawValue->getWithdrawFinishTime()) ? $this->shopDateFormat()->shopWithdrawTime($withdrawValue->getWithdrawFinishTime()) : ''; ?></td>
                                    <td><?php echo $this->escapeHtml($withdrawValue->getWithdrawInfo()); ?></td>
                                    <td>
                                        <?php if($withdrawValue->getWithdrawState() == 1) { ?>
                                            <a href="<?php echo $this->url('user-balance', ['action'=>'reviewWithdraw', 'id' => $withdrawValue->getWithdrawId()]); ?>" class="btn btn-xs btn-success"><i class="fa fa-pencil"></i> <?php echo $this->translate('审核'); ?></a>
                                            <a href="javascript:;" onclick="deleteNotConfirm( '<?php echo $this->url('user-balance', ['action'=>'deleteWithdraw', 'id'=>$withdrawValue->getWithdrawId()]); ?>', '');" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i> <?php echo $this->translate('删除'); ?></a>
                                        <?php } ?>
                                    </td>
                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <?php echo $this->paginationControl($this->withdrawList, 'Sliding', 'layout/page', ['route' => 'user-balance', 'params' => ['action' => 'withdrawList']]); ?>
                    </div>
                </div>
            </div>
        </div>

    </section>
</div>
<script>
    laydate.render({elem: '#add_start_time'});
    laydate.render({elem: '#add_end_time'});
    laydate.render({elem: '#finish_start_time'});
    laydate.render({elem: '#finish_end_time'});
</script>